#!/usr/bin/python
# -*- coding:utf-8 -*-
from flask import g
from flask import render_template
from sqlalchemy import desc

from app.actions.main import main
from app.database.enums import PUBLISHED_BLOG
from app.database.models import Blog


@main.route('/', methods=['GET'])
def index():
    # 个人信息
    # 最新文章信息
    latest_blog_list = Blog.query.filter_by(author_id=g.default_user.id, status=PUBLISHED_BLOG).order_by(desc(Blog.publish_time)).limit(6)
    return render_template('index.html', **locals())



